#ifndef _ITERATOR_H_
#define _ITERATOR_H_

#include "List.h"

#define Iterator_DEF \
int pos; \
List *list;

#define Iterator_SHARED \
FN(int, hasNext); \
FN(void *, next); \
FN(void, begin, List *list);

#define Iterator_EXCLUSIVE

BUILD_OBJ(Iterator)

#define FOREACH(var, list) {Iterator *it=IteratorI()->create(); C(it, begin)(list); while(C(it, hasNext)()){var = C(it, next)();
#define EFOR }D(it);}

#endif
